#include <server/Server.h>
#include <catch_amalgamated.hpp>

TEST_CASE("测试从文件读取服务器配置") {
    string _js = R"(
        {
          "version": 0,
          "host": "0.0.0.0",
          "port": 6666
        }
)";
    json _json = json::parse(_js);
    ServerConfig sc = ServerConfig(_json);
    SECTION("端口") {
        REQUIRE(sc.listen_port == 6666);
    }

    SECTION("地址") {
        REQUIRE(sc.host == "0.0.0.0");
    }

    SECTION("配置文件版本") {
        REQUIRE(sc.version == 0);
    }

}
